home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / bbs / maxkit25.zip / CKXP-DOB.ARJ / CKXP-DOB.MEX next >
Text File  |  1996-11-05  |  3KB  |  89 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //                   Free for non-commercial use.
  3. // Copyright 1995 by Gerry Ellison.  All rights reserved.
  4. // File: ckxp-dob.mex   v1.01 by Gerry Ellison          1:108/107
  5. // Desc: Routine to check user's expiry time,
  6. // Desc: Routine to check user's date of birth and call Birthday File.
  7. // Copyright 1995 by Gerry Ellison.  All rights reserved.
  8. // $Id: CKXP-DOB.MEX 1.0 1995/10/22 24:00:00 gre Exp $
  9. //////////////////////////////////////////////////////////////////////////////
  10. //  #define DEBUG
  11.  
  12. #include <max.mh>
  13.  
  14.   int substrtoi(ref string: s, int: start, int: len)
  15. {
  16.   string: t;
  17.   t:=substr(s,start,len);
  18.   return strtoi(t);
  19. }
  20.  
  21. //int main(string: argv)
  22. int main()
  23. {
  24.   char: nonstop;
  25.     int: dx, dm;
  26.  
  27. //  nonstop:=0;
  28.  
  29.  struct _stamp: cur;        // Current date/time
  30.     int: cd;                // Binary current day
  31.     int: cm;                // Binary current month
  32.     int: cy;                // Binary current year
  33.     int: bd;                // Binary day of birth
  34.     int: bm;                // Binary month of birth
  35.     int: xd;                // Binary expire day
  36.     int: xm;                // Binary expire month
  37.     int: xy;                // Binary expire year
  38.  
  39.  // Set dates.
  40.  timestamp(cur);
  41.     cd:=cur.date.day;
  42.     cm:=cur.date.month;
  43.     cy:=cur.date.year;
  44.     bd:=substrtoi(usr.dob,9,2);
  45.     bm:=substrtoi(usr.dob,6,2);
  46.     xd:=usr.xp_date.date.day;
  47.     xm:=usr.xp_date.date.month;
  48.     xy:=usr.xp_date.date.year;
  49. {
  50. }
  51.   // Check for days in month.
  52.     if (cm=2)  dm:=27;
  53.       else if (cm=2 and cy=16) dm:=28;
  54.       else if (cm=4 or cm=6 or cm=9 or cm=11) dm:=30;
  55.       else dm:=31;
  56. {
  57.   // Check if user has expiry set.
  58.   if (usr.expdate=FALSE)
  59.      print("\x16\x01\x0e ***                For Additional Time see Main Menu.                ***\n");
  60.  
  61.   if (usr.expdate=TRUE)
  62.   // Check if expiry is in this month.
  63.      if (cy=xy and cm=xm and xd-cd >0=1)
  64.      print("\x16\x01\x0c        *** Time flies, your account expires in ",xd-cd," Days ***\n");
  65.  
  66.   // Check if expiry is in next month.
  67.   else if (cy=xy and cm+1=xm and (dm-cd)+(xd)<30=1)
  68.      print("\x16\x01\x0c          *** Time flies, your account expires in ",(dm-cd)+(xd)," Days ***\n");
  69.  
  70.   // Check if expiry is in next year.
  71.   else if (cy+1=xy and cm-11=xm and (dm-cd)+xd<30=1)
  72.      print("\x16\x01\x0c         *** Time flies, your account expires in ",(dm-cd)+xd," Days ***\n");
  73.  
  74.   // Print thank you screen.
  75.      else
  76.      print("\x16\x01\x0a  ***           Thanks for your support of The Mountain Top.           ***\n");
  77.  }
  78.  {
  79.   // substr(usr.dob,3,2) = "00";
  80.  }
  81.  {
  82.   // Check for user birth day and display Birthday.bbs if true.
  83.   if (cm=bm and cd=bd)
  84.      display_file("C:\\Max\\MaxKit\\Birthday.bbs", nonstop);
  85.   else
  86.      return 0;
  87. }
  88. }
  89.